package com.android.launcher3;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.SubMenu;

/**
 * 
 * 自定义菜单 item
 * 
 */
public class OptionMenuItem implements MenuItem {

	private Context context;
	private CharSequence title;
	private int groupId;
	private int itemId;
	private int order;
	private Drawable icon;

	private boolean enabled;
	private boolean checked;
	private boolean visible;
	private boolean checkable;
	private boolean hasSubMenu;

	private char alphabeticShortcut;
	private Intent intent;

	public OptionMenuItem(Context context) {
		this.context = context;
		this.visible = true;
	}

	public OptionMenuItem(Context context, int groupId, int itemId, int order,
			CharSequence title) {
		this.context = context;
		this.groupId = groupId;
		this.itemId = itemId;
		this.order = order;
		this.title = title;
		this.visible = true;
	}

	public char getAlphabeticShortcut() {
		return alphabeticShortcut;
	}

	public int getGroupId() {
		return groupId;
	}

	public Drawable getIcon() {
		return icon;
	}

	public Intent getIntent() {
		return intent;
	}

	public int getItemId() {
		return itemId;
	}

	public ContextMenuInfo getMenuInfo() {
		return null;
	}

	public char getNumericShortcut() {
		return 0;
	}

	public int getOrder() {
		return order;
	}

	public SubMenu getSubMenu() {
		return null;
	}

	public CharSequence getTitle() {
		return title;
	}

	public CharSequence getTitleCondensed() {
		return null;
	}

	public boolean hasSubMenu() {
		return hasSubMenu;
	}

	public boolean isCheckable() {
		return checkable;
	}

	public boolean isChecked() {
		return checked;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public boolean isVisible() {
		return visible;
	}

	public OptionMenuItem setAlphabeticShortcut(char alphaChar) {
		this.alphabeticShortcut = alphaChar;
		return this;
	}

	public OptionMenuItem setCheckable(boolean checkable) {
		this.checkable = checkable;
		return this;
	}

	public OptionMenuItem setChecked(boolean checked) {
		this.checked = checked;
		return this;
	}

	public OptionMenuItem setEnabled(boolean enabled) {
		this.enabled = enabled;
		return this;
	}

	public OptionMenuItem setIcon(Drawable icon) {
		this.icon = icon;
		return this;
	}

	public OptionMenuItem setIcon(int iconRes) {
		return setIcon(context.getResources().getDrawable(iconRes));
	}

	public OptionMenuItem setIntent(Intent intent) {
		this.intent = intent;
		return this;
	}

	public OptionMenuItem setNumericShortcut(char numericChar) {
		return null;
	}

	public OptionMenuItem setOnMenuItemClickListener(
			OnMenuItemClickListener menuItemClickListener) {
		return null;
	}

	public OptionMenuItem setShortcut(char numericChar, char alphaChar) {
		return null;
	}

	public OptionMenuItem setTitle(CharSequence title) {
		this.title = title;
		return this;
	}

	public OptionMenuItem setTitle(int title) {
		return setTitle(context.getString(title));
	}

	public OptionMenuItem setTitleCondensed(CharSequence title) {
		return null;
	}

	public OptionMenuItem setVisible(boolean visible) {
		this.visible = visible;
		return this;
	}

}
